package org.myxdb.server.message;

import java.util.HashMap;
import java.util.Map;

import org.myxdb.core.database.database;

public class RenameDB implements RPCMessage{

	 public Map execute(Map message) {
		 
		 String dbname = (String)message.get("dbname");
		 String newname = (String)message.get("newname");
		 Map result = new HashMap(); 
		 if(new database().renamedb(dbname, newname))
		 {
			 result.put("result", "Rename Database "+dbname+" to "+newname+" successfully");
		 }
		 else
			 result.put("result", "Fail to Rename Database "+dbname);
		 return result;
	 }
}
